﻿#ifndef PRODUCTTABLEVIEW_H
#define PRODUCTTABLEVIEW_H

#include "mytableview.h"
#include "productstandarditemmodel.h"
#include "product.h"
#include "dbhelper.h"
#include "listpushbutton.h"

class ProductTableView : public MyTableView
{
    Q_OBJECT
public:
    explicit ProductTableView(QWidget *parent = nullptr);

    void insertProduct(QList<Product*> products);

    void queryProduct(
            int limitIndex,
            QString overallQuery,
            QString typeQuery,
            QString nameQuery,
            QString primaryQuery,
            QString secondaryQuery);

    void clear();

    void initHiddenState();

    void setListPushButton(ListPushButton *listPushButton);

    Product* currentProduct();

    void loadProucts();

    QList<Product*> selectedProducts();

signals:
    void updateTotalValue(int totalCount, int totalSanbao, double totalInPrice);

public slots:

private:
    ProductStandardItemModel *model;
};

#endif // PRODUCTTABLEVIEW_H
